<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class InsertClassRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name' => 'required|string',
            'course_id' => 'required|Numeric',
            'category_id' => 'required|Numeric',
            'price' => 'required|numeric'
        ];
    }
    public function messages()
    {
        return [
            'name.required' => '课时名称不能为空',
            'name.String' => '课时名称必须是字符串',
            'course_id.required' => '课程不能为空',
            'course_id.Numeric' => '课程必须是数字',
            'category_id.required' => '分类不能为空',
            'category_id.Numeric' => '分类必须是数字',
            'price.required' => '价格不能为空',
            'price.numeric' => '价格必须是数字'
        ];
    }
}
